import request from '/@/utils/request';
// 入库单分页
export const inboundPage = (data: any) => {
	const { current, size, ascs, descs } = data;
	const params = { current, size, ascs, descs };
	return request({
		url: `/wms/wmsInboundOrder/page`,
		method: 'post',
		params,
		data,
	});
};


// 获取可用库位
export const getPositionList = (data: any) => {
	return request({
		url: `/wms/wmsInboundOrder/getPositionList`,
		method: 'post',
		data,
	});
};

// 新增入库单
export const saveInboundOrder = (data: any) => {
	return request({
		url: `/wms/wmsInboundOrder`,
		method: 'post',
		data,
	});
};

// 通过id查询入库单详情
export const inboundOrderDetail = (id) => {
	return request({
		url: `/wms/wmsInboundOrder/${id}`,
		method: 'get',
	});
};

// 修改入库单
export const editInboundOrder = (data: any) => {
	return request({
		url: `/wms/wmsInboundOrder`,
		method: 'put',
		data,
	});
};


// 提交入库单
export const submitInboundOrder = (data: any) => {
	return request({
		url: `/wms/wmsInboundOrder/submit`,
		method: 'post',
		data,
	});
};

// 完成收货
export const completeReceive = (data: any) => {
	return request({
		url: `/wms/wmsInboundOrder/completeReceive`,
		method: 'post',
		data,
	});
};

// 完成质检
export const completeInspection = (data: any) => {
	return request({
		url: `/wms/wmsInboundOrder/completeInspection`,
		method: 'post',
		data,
	});
};

// 批量免检
export const withoutInspection = (data: any) => {
	return request({
		url: `/wms/wmsInboundOrder/withoutInspection`,
		method: 'post',
		data,
	});
};

// 点击入库展示的入库明细页面
export const showInboundDetail = (data: any) => {
	return request({
		url: `/wms/wmsInboundOrder/showInboundDetail`,
		method: 'post',
		data,
	});
};

// 完成入库
export const completeInbound = (data: any) => {
	return request({
		url: `/wms/wmsInboundOrder/completeInbound`,
		method: 'post',
		data,
	});
};

// 作废入库单
export const cancelInbound = (id) => {
	return request({
		url: `/wms/wmsInboundOrder/cancel/${id}`,
		method: 'put',
	});
};

// 导出excel 表格
export const exportInbound = (data: any) => {
	return request({
		url: `/wms/wmsInboundOrder/export`,
		method: 'post',
		data,
	});
};
export const getDicts = (type: String) => {
	return request({
		url: `/admin/dict/type/${type}`,
		method: 'get',
	});
};

// 通过业务id查询业务流程信息
export function getLatestByBusId(params) {
	return request({
		url: '/wms/flow/getLatestByBusId',
		method: 'get',
		params,
	});
}

export function getCompanyTeamTree(params) {
	return request({
		url: '/admin/companyTeam/tree',
		method: 'get',
		params,
	});
}

// 仓库树形结构
export function getwhTree(params) {
	return request({
		url: '/wms/warehouse/whTree',
		method: 'get',
		params,
	});
}

// 备货区域
export function sysStockArea() {
	return request({
		url:  '/admin/sysStockArea/list',
    method: 'get',
	});
} 

// 获取平台列表
export function getPlatformList(params) {
	return request({
		url: '/admin/sysPlatform/listAll',
		method: 'get',
		params,
	});
}

// 供应商列表查询接口
export function searchBySupplierName(params?: object) {
	return request({
		url: '/purchase/supplier/list',
		method: 'get',
		params,
	});
}

 
export const stockSkuList = (data: any) => {
	const { current, size, ascs, descs } = data;
	const params = { current, size, ascs, descs };
	return request({
		url: `/wms/transferOrder/stockSku`,
		method: 'post',
		params,
		data,
	});
};
